package com.yzy.controller;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author yangzhenyu
 * @version 1.0
 * @description:
 * @date 2022/6/6 17:31
 */
public class Test02 {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("1");
        list.add("2");
        list.add("2");
        list.add("3");

        //list去重 并 list转为数组
        List<String> collect = list.stream().distinct().collect(Collectors.toList());
        String [] dates = new String[collect.size()];
        collect.toArray(dates);
        System.out.printf(JSON.toJSONString(dates));

    }








}
